<?php
session_start();
error_reporting(7);
require_once '../../includes/global.php';
require_once '../../includes/function/infofunction.php';
//搜索下拉列表


if($_POST[op]=='wbinsert'||$_POST[op]=='wbmodify'){
//print_r($_POST);
//print_r($_FILES);
echo'aaaa';

if($_FILES['pic']['tmp_name']!=""){
$time=time();
$otype=explode(".",strtolower($_FILES[pic][name]));
 if($_FILES[pic][size]>0&&!($_FILES[pic][type]=="image/pjpeg"||$_FILES[pic][type]=="image/gif")) 	     {
		?>
           <script>
		           alert("图片格式不正确!");
				   window.history.back(1);
		   </script>
		<?php
    }
    $filename="../../uploads/pic/".$time.".".$otype[1];
	$copymes=copy($_FILES['pic']['tmp_name'] ,$filename);
	$_POST[pic]=$time.".".$otype[1];
createthumb($_FILES['pic']['tmp_name'],".".$otype[1],$time);
 }
$_POST[adddate]=time();
$_POST[content]= stripslashes($_POST[content]);
$_POST[userid]=$_SESSION[userinfo][username];
$zd="abcdefghijklmnopqrstuvwxyz";
	for($ii=13;$ii<26;$ii++)
	{
	  $uu=substr($zd,$ii,1);
	 $_POST['a'.$uu]=implode("#",$_POST['a'.$uu]);
	}
	if($_POST[op]=='wbinsert')
	{unset($_POST[id]);
	Di("info",$_POST);
	Jt($_SERVER['HTTP_REFERER'],'添加成功');
	}
	else
	{
	Du('info',$_POST,'id',$_POST[id]);
	Jt($_SERVER['HTTP_REFERER'],'更新成功');
	}
exit;
}

if($_GET[op]=='view'){

$zd[cw]=1;
Du('info',$zd,'id',$_GET[id]);



$zd="abcdefghijklmnopqrstuvwxyz";
$ttt->assign('sortid',$_GET[sortid]);
$w=Dga('infosort',"id='".$_GET[sortid]."'");

//Get table'name;
if($w[tname]!=''){
$tname=$w[tname];
}else{
$tname='info';
}

$ttt->assign("parenttitle",$w[title]);
$info=array();$content=array();
$info=Dga($tname,"id='".$_GET[id]."'");
$info[content]=html_entity_decode($info[content]);
$ttt->assign('info',$info);
		$jgs=0;
		for($ii=0;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w[$uu]=unserialize($w[$uu]);
			foreach($temp[$uu] as $key =>$value)
			{
			$w[$uu][$key]=stripslashes($value);
			}
			if($w[$uu][title]!='')
			{
	$content[$jgs][title]=$w[$uu][title];
	$content[$jgs][form]="".$info[$uu]."";
	$jgs++;
			}
		}
		for($ii=0;$ii<13;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w['a'.$uu]=unserialize($w['a'.$uu]);
			foreach($w['a'.$uu] as $key =>$value)
			{
			$w['a'.$uu][$key]=stripslashes($value);
			}
			if($w['a'.$uu][title]!='')
			{$yarray=array();
			$xarray=array();
	$content[$jgs][title]=$w['a'.$uu][title];
					$temp=explode('#',$w['a'.$uu][value]);
					foreach($temp as $value)
					{
					    $ttemp=explode('-',$value);
						$yarray[]=$ttemp[0];
						$xarray[]=$ttemp[1];
					}
			if($info['a'.$uu]!='')
				{
				$w['a'.$uu][dvalue]=$info['a'.$uu];
				}

	$content[$jgs][form]=unvar($_GET[sortid],'a'.$uu,$w['a'.$uu][dvalue]);
	$jgs++;
			}
		}

		for($ii=13;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w['a'.$uu]=unserialize($w['a'.$uu]);
			foreach($w['a'.$uu] as $key =>$value)
			{
			$w['a'.$uu][$key]=stripslashes($value);
			}
			if($w['a'.$uu][title]!='')
			{$yarray=array();
			$xarray=array();
	$content[$jgs][title]=$w['a'.$uu][title];
					$temp=explode('#',$w['a'.$uu][value]);
					foreach($temp as $value)
					{
					    $ttemp=explode('-',$value);
						$yarray[]=$ttemp[0];
						$xarray[]=$ttemp[1];
					}

				if($info['a'.$uu]!='')
				{
				$w['a'.$uu][dvalue]=$info['a'.$uu];
				}
					$ssdf=uncheckbox($_GET[sortid],'a'.$uu,$w['a'.$uu][dvalue]);
					$ssdf=implode("#",$ssdf);
	$content[$jgs][form]=$ssdf;
	$jgs++;
			}
		}

			for($ii=0;$ii<10;$ii++)
			{
				$uu=substr($zd,$ii,1);
				$w['b'.$uu]=unserialize($w['b'.$uu]);
				foreach($w['b'.$uu] as $key =>$value)
				{
				$w['b'.$uu][$key]=stripslashes($value);
				}
				if($w['b'.$uu][title]!='')
				{$yarray=array();
				$xarray=array();
		$content[$jgs][title]=$w['b'.$uu][title];
						$temp=explode('#',$w['b'.$uu][value]);
						foreach($temp as $value)
						{
							$ttemp=explode('-',$value);
							$yarray[]=$ttemp[0];
							$xarray[]=$ttemp[1];
						}
			if($info['b'.$uu]!='')
				{
				$w['b'.$uu][dvalue]=$info['b'.$uu];
				}

		$content[$jgs][form]=unvar($_GET[sortid],'b'.$uu,$w['b'.$uu][dvalue]);
		$jgs++;
				}
			}


		for($ii=10;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w['b'.$uu]=unserialize($w['b'.$uu]);
			foreach($w['b'.$uu] as $key =>$value)
			{
			$w['b'.$uu][$key]=stripslashes($value);
			}
			if($w['b'.$uu][title]!='')
			{
	$content[$jgs][title]=$w['b'.$uu][title];
	$content[$jgs][form]=html_entity_decode(stripslashes($info['b'.$uu]));
	$jgs++;
			}
		}

			for($ii=0;$ii<13;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w['c'.$uu]=unserialize($w['c'.$uu]);
			foreach($w['c'.$uu] as $key =>$value)
			{
			$w['c'.$uu][$key]=stripslashes($value);
			}
			if($w['c'.$uu][title]!='')
			{
	$content[$jgs][title]=$w['c'.$uu][title];
	$content[$jgs][form]=" <a href=\"#\" onClick=\"viewbdlist('".$w['c'.$uu][value]."','".$_GET[sortid]."','".$_GET[id]."')\">〖<font color=red>浏览".$w['c'.$uu][title]."</font>〗</a>";
	$jgs++;
			}
		}


			for($ii=13;$ii<18;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w['c'.$uu]=unserialize($w['c'.$uu]);
			foreach($w['c'.$uu] as $key =>$value)
			{
			$w['c'.$uu][$key]=stripslashes($value);
			}
			if($w['c'.$uu][title]!='')
			{
	$content[$jgs][title]=$w['c'.$uu][title];
	$content[$jgs][form]=" <a href=\"#\" onClick=\"getpic('".$_GET[sortid]."','c".$uu."','".$_GET[id]."')\">超级文件上传类 </a>支持〖".$w['c'.$uu][value]."〗格式";
	$jgs++;
			}
		}







for($ii=0;$ii<6;$ii++)//sort_binding
		{
			$uu=substr($zd,$ii,1);
			$w['d'.$uu]=unserialize($w['d'.$uu]);
			foreach($w['d'.$uu] as $key =>$value)
			{
			$w['d'.$uu][$key]=stripslashes($value);
			}
			if($w['d'.$uu][title]!='')
			{
	$content[$jgs][title]=$w['d'.$uu][title];

  $drop_down_info='';
  drop_down_list($w['d'.$uu][sortid],0,$info['d'.$uu]);

	$content[$jgs][form] =   $drop_down_info;
	$jgs++;
			}
		}





		$ttt->assign('sinfo',$w);





$ttt->assign('content',$content);



$ttt->assign("sorts",$sorts);
Ts("info/view.htm");
}


if($_GET[op]=='addsort'||$_GET[op]=='editsort'){
$zd="abcdefghijklmnopqrstuvwxyz";

	if($_GET[op]=='addsort')
	{
	$ttt->assign('op','insertsort');
	$ttt->assign("id",'');
	$ttt->assign("parentid",$_GET[id]);
	$temp=Dga('infosort',"id='".$_GET[id]."'");
	if($temp)
	{
	$ttt->assign("parenttitle",$temp[title]);
	}
	else
	{
	$ttt->assign("parenttitle","根分类");
	}
	$temp[title]='';
	}
	else
	{
	    $ttt->assign("id",$_GET[id]);
		$w=Dga('infosort',"id='".$_GET[id]."'");
		$ttt->assign("parentid",$w[parentid]);
		$w=Dga('infosort',"id='".$w[parentid]."'");
		if($w)
		{
		$ttt->assign("parenttitle",$w[title]);
		}
		else
		{
		$ttt->assign("parenttitle","根分类");
		}
		$ttt->assign('op','modifysort');
		$temp=Dga('infosort'," id ='".$_GET[id]."'");

	}

$temp['ft']=stripslashes($temp['ft']);
		$temp['fb']=stripslashes($temp['fb']);
		$temp['fr']=stripslashes($temp['fr']);
		$temp['fs']=stripslashes($temp['fs']);
		$temp['fh']=stripslashes($temp['fh']);

		for($ii=0;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$temp[$uu]=unserialize($temp[$uu]);
			foreach($temp[$uu] as $key =>$value)
			{
			$temp[$uu][$key]=stripslashes($value);
			}

		}
		for($ii=0;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$temp['a'.$uu]=unserialize($temp['a'.$uu]);
			foreach($temp['a'.$uu] as $key =>$value)
			{
			$temp['a'.$uu][$key]=stripslashes($value);
			}
		}
		for($ii=0;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$temp['b'.$uu]=unserialize($temp['b'.$uu]);
			foreach($temp['b'.$uu] as $key =>$value)
			{
			$temp['b'.$uu][$key]=stripslashes($value);
			}
		}
			for($ii=0;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$temp['c'.$uu]=unserialize($temp['c'.$uu]);
			foreach($temp['c'.$uu] as $key =>$value)
			{
			$temp['c'.$uu][$key]=stripslashes($value);
			}
		}
			for($ii=0;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$temp['d'.$uu]=unserialize($temp['d'.$uu]);
			foreach($temp['d'.$uu] as $key =>$value)
			{
			$temp['d'.$uu][$key]=stripslashes($value);
			}
		}
		$ttt->assign('sinfo',$temp);
$text="";
for($ii=0;$ii<26;$ii++)
{ $uu=substr($zd,$ii,1);

	$text.="  <tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         参数名称：<input value=\"".$temp[$uu][title]."\" name=\"".$uu."[title]\" /><input type=\"radio\" name=\"".$uu."[xs]\" value=\"1\" ".(($temp[$uu][xs]=='1')?("checked=\"checked\""  ):(""))."/> 显 <input type=\"radio\" name=\"".$uu."[xs]\" value=\"0\" ".(($temp[$uu][xs]=='0')?("checked=\"checked\""  ):(""))."/>隐   <input type=\"checkbox\" name=\"".$uu."[ss]\" value=\"1\" ".(($temp[$uu][ss]=='1')?("checked=\"checked\""  ):(""))."/>搜索 样式：<input  name=\"".$uu."[style]\"  value=\"".$temp[$uu][style]."\"/>  js:<input  name=\"".$uu."[js]\"  value=\"".$temp[$uu][js]."\"/> 插件：<input  name=\"".$uu."[chajian]\" />
        </div>
      </label></td>
    </tr>";
}
$ttt->assign('text',$text);

$text="";
for($ii=0;$ii<13;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="  <tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">a".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         radio_title：<input  name=\"a".$uu."[title]\"  value=\"".$temp['a'.$uu][title]."\"/><input type=\"radio\" name=\"a".$uu."[xs]\" value=\"1\" ".(($temp['a'.$uu][xs]=='1')?("checked=\"checked\""  ):(""))."/> 显 <input type=\"radio\" name=\"a".$uu."[xs]\" value=\"0\" ".(($temp['a'.$uu][xs]=='0')?("checked=\"checked\""  ):(""))."/>隐   <input type=\"checkbox\" name=\"a".$uu."[ss]\" value=\"1\" ".(($temp['a'.$uu][ss]=='1')?("checked=\"checked\""  ):(""))."/>搜索  值对：<input name=\"a".$uu."[value]\"  value=\"".$temp['a'.$uu][value]."\"/> default:<input  name=\"a".$uu."[dvalue]\" value=\"".$temp['a'.$uu][dvalue]."\"/> 样式：<input name=\"a".$uu."[style]\" value=\"".$temp['a'.$uu][style]."\"/>   js:<input  name=\"a".$uu."[js]\" value=\"".$temp['a'.$uu][js]."\"/> 插件：<input name=\"a".$uu."[chajian]\" value=\"".$temp['a'.$uu][chajian]."\"/>
        </div>
      </label></td>
    </tr>";
}
for($ii=13;$ii<26;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="  <tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">a".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         checkbox_title：<input  name=\"a".$uu."[title]\"  value=\"".$temp['a'.$uu][title]."\"/> <input type=\"radio\" name=\"a".$uu."[xs]\" value=\"1\" ".(($temp['a'.$uu][xs]=='1')?("checked=\"checked\""  ):(""))."/> 显 <input type=\"radio\" name=\"a".$uu."[xs]\" value=\"0\" ".(($temp['a'.$uu][xs]=='0')?("checked=\"checked\""  ):(""))."/>隐   <input type=\"checkbox\" name=\"a".$uu."[ss]\" value=\"1\" ".(($temp['a'.$uu][ss]=='1')?("checked=\"checked\""  ):(""))."/>搜索 值对：<input name=\"a".$uu."[value]\"  value=\"".$temp['a'.$uu][value]."\"/> default:<input  name=\"a".$uu."[dvalue]\" value=\"".$temp['a'.$uu][dvalue]."\"/> 样式：<input name=\"a".$uu."[style]\" value=\"".$temp['a'.$uu][style]."\"/>   js:<input  name=\"a".$uu."[js]\" value=\"".$temp['a'.$uu][js]."\"/> 插件：<input name=\"a".$uu."[chajian]\" value=\"".$temp['a'.$uu][chajian]."\"/></div>
      </label></td>
    </tr>";
}
$ttt->assign('radio_chebox',$text);

$text="";
for($ii=0;$ii<10;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="  <tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">b".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         select_title：<input  name=\"b".$uu."[title]\"  value=\"".$temp['b'.$uu][title]."\"/> <input type=\"radio\" name=\"b".$uu."[xs]\" value=\"1\" ".(($temp['b'.$uu][xs]=='1')?("checked=\"checked\""  ):(""))."/> 显 <input type=\"radio\" name=\"b".$uu."[xs]\" value=\"0\" ".(($temp['b'.$uu][xs]=='0')?("checked=\"checked\""  ):(""))."/>隐    <input type=\"checkbox\" name=\"b".$uu."[ss]\" value=\"1\" ".(($temp['b'.$uu][ss]=='1')?("checked=\"checked\""  ):(""))."/>搜索 值对：<input name=\"b".$uu."[value]\"  value=\"".$temp['b'.$uu][value]."\"/> default:<input  name=\"b".$uu."[dvalue]\" value=\"".$temp['b'.$uu][dvalue]."\"/> 样式：<input name=\"b".$uu."[style]\" value=\"".$temp['b'.$uu][style]."\"/>   js:<input  name=\"b".$uu."[js]\" value=\"".$temp['b'.$uu][js]."\"/> 插件：<input name=\"b".$uu."[chajian]\" value=\"".$temp['b'.$uu][chajian]."\"/> </div>
      </label></td>
    </tr>";
}

for($ii=10;$ii<26;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="  <tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">b".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         ubb_title：<input  name=\"b".$uu."[title]\"  value=\"".$temp['b'.$uu][title]."\"/>样式：<input name=\"b".$uu."[style]\" value=\"".$temp['b'.$uu][style]."\"/>   js:<input  name=\"b".$uu."[js]\" value=\"".$temp['b'.$uu][js]."\"/> 插件：<input name=\"b".$uu."[chajian]\" value=\"".$temp['b'.$uu][chajian]."\"/> </div>
      </label></td>
    </tr>";
}
$ttt->assign('select_ubb',$text);

//function inner_binding
$text="";
for($ii=0;$ii<13;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="  <tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">c".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         inner_binding：<input  name=\"c".$uu."[title]\"  value=\"".$temp['c'.$uu][title]."\"/>BIND_SORTID：<input name=\"c".$uu."[value]\"  value=\"".$temp['c'.$uu][value]."\"/> </div>
      </label></td>
    </tr>";
}

for($ii=13;$ii<18;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="  <tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">c".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         file_binding：<input  name=\"c".$uu."[title]\"  value=\"".$temp['c'.$uu][title]."\"/>BIND_type：<input name=\"c".$uu."[value]\"  value=\"".$temp['c'.$uu][value]."\"/> </div>
      </label></td>
    </tr>";
}

for($ii=18;$ii<22;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="<tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">c".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         order_contril：<input  name=\"c".$uu."[title]\"  value=\"".$temp['c'.$uu][title]."\"/></div>
      </label></td>
    </tr>";
}
	$text.="  <tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">cw:</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         soud_alert：<input  name=\"cw\"  value=\"1\" ".(($temp[cw]==1)?('checked=\"checked\"'):(''))." type=\"radio\"/> open  <input  name=\"cw\"  value=\"2\"  ".(($temp[cw]==2||$temp[cw]=='')?('checked=\"checked\"'):(''))."  type=\"radio\"/> close</div>
      </label></td>
    </tr>";
for($ii=23;$ii<24;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="<tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">c".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         file_txt：Title <input  name=\"c".$uu."[title]\"  value=\"".$temp['c'.$uu][title]."\"/> Path <input  name=\"c".$uu."[lujing]\"  value=\"".$temp['c'.$uu][lujing]."\"  style=\"width:200px\"/></div>
      </label></td>
    </tr>";
}

for($ii=24;$ii<25;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="<tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">c".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         file_lang：Title <input  name=\"c".$uu."[title]\"  value=\"".$temp['c'.$uu][title]."\"/> Path <input  name=\"c".$uu."[lujing]\"  value=\"".$temp['c'.$uu][lujing]."\"  style=\"width:200px\"/></div>
      </label></td>
    </tr>";
}

for($ii=25;$ii<26;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="<tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">c".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         file_ubb：Title <input  name=\"c".$uu."[title]\"  value=\"".$temp['c'.$uu][title]."\"/> Path <input  name=\"c".$uu."[lujing]\"  value=\"".$temp['c'.$uu][lujing]."\"  style=\"width:200px\"/></div>
      </label></td>
    </tr>";
}

//sortbd
for($ii=0;$ii<6;$ii++)
{ $uu=substr($zd,$ii,1);
	$text.="<tr>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><div align=\"right\">d".$uu.":</div></td>
      <td height=\"25\" bgcolor=\"#FFFFFF\" nowrap=\"nowrap\"><label>
       <div align=\"left\">
         sort_binding：Title <input  name=\"d".$uu."[title]\"  value=\"".$temp['d'.$uu][title]."\"/> binding id <input  name=\"d".$uu."[sortid]\"  value=\"".$temp['d'.$uu][sortid]."\"  style=\"width:26px\"/><input type=\"checkbox\" name=\"d".$uu."[dx]\" value=\"1\" ".(($temp['d'.$uu][dx]=='1')?("checked=\"checked\""  ):(""))."/>多选</div>
      </label></td>
    </tr>";
}
$ttt->assign('function',$text);
Ts("info/sort.php");
//ce($temp);

exit;
}


if($_POST[op]=='insertsort'||$_POST[op]=='modifysort'){


$zd="abcdefghijklmnopqrstuvwxyz";

	for($ii=0;$ii<26;$ii++)
	{
		$uu=substr($zd,$ii,1);
		$_POST[$uu]=serialize($_POST[$uu]);
	}
	for($ii=0;$ii<26;$ii++)
	{
		$uu=substr($zd,$ii,1);
		$_POST['a'.$uu]=serialize($_POST['a'.$uu]);
	}
	for($ii=0;$ii<26;$ii++)
	{
		$uu=substr($zd,$ii,1);
		$_POST['b'.$uu]=serialize($_POST['b'.$uu]);
	}
		for($ii=0;$ii<26;$ii++)
	{
		$uu=substr($zd,$ii,1);
		$_POST['c'.$uu]=serialize($_POST['c'.$uu]);
	}
		for($ii=0;$ii<26;$ii++)
	{
		$uu=substr($zd,$ii,1);
		$_POST['d'.$uu]=serialize($_POST['d'.$uu]);
	}

	if($_POST[op]=='insertsort'){
	$_POST['userid']=$_SESSION[userinfo][user];
 	unset($_POST[id]);
 	Di('infosort',$_POST);
	Jt($_SERVER['HTTP_REFERER'],'添加成功');
	}
	else
	{
		$_POST['userid']=$_SESSION[userinfo][user];
	Du('infosort',$_POST,'id',$_POST[id]);
	Jt($_SERVER['HTTP_REFERER'],'更新成功');
	}
}

if($_GET[op]=='listsort'){


//print_r($_GET);
$ttt->assign('id',$_GET[id]);
$ttt->assign('username',$_GET[username]);

if(isset($_GET[offset]) and isset($_GET[pageline])){
$classtest = new tviewpage($prefix."_infosort",$_GET[pageline],$_GET[offset]);
//echo "GET";
}
else{

$offset=0;
$pageline=12;
$classtest = new tviewpage($prefix."_infosort",$pageline,$offset);

//echo "none";
}
/* ò?
if($_GET[id]!=''){
$condition=" where 1";
	if($_GET[id]==0){
$_SESSION[condition]=$condition;
	}
	else
	{
$condition.=" and sortid =".$_GET[id];
$_SESSION[condition]=$condition;
	}
}*/
$classtest->setCondition(" where parentid = '".$_GET[id]."' and  title like '%".$_GET[title]."%'  and ( userid like '%".$_GET[username]."%' )  and del != 1  ORDER BY `id`  DESC  ");

$classtest->setPageQuery('op','listsort');
$classtest->setPageQuery('id',$_GET[id]);
$classtest->setPageQuery($_SESSION[LG],$_GET[$_SESSION[LG]]);
$classtest->setPageQuery('username',$_GET[username]);

$recordset = $classtest->getRecords();
ob_start();
$classtest->showFullFunc();
$nav = ob_get_contents();
ob_end_clean();
$ttt->assign("nav","$nav");


$j = count($recordset);

if($_GET[id]==-1){
$sortname="顶级分类";
}
else
{
$w=Dga('infosort',"id =".$_GET[id]);
$sortname="<a href=\"info.php?op=listsort&id=$w[parentid]\">$w[title]</a>";
}


for($t=0;$t<$j;$t=$t+1){
$w=Dga('infosort',"  del != 1  and  parentid =".$recordset[$t][id]);

$content.="<TR>
    <TD bgColor=#ffffff height=25 >".(($w)?("<a href=\"info.php?op=listsort&id=".$recordset[$t][id]."&pid=".$recordset[$t][parentid]."\"><font color=red> _|_ </font>".$recordset[$t][title]."</a>"):($recordset[$t][title]))."</TD>
    <TD bgColor=#ffffff height=25 >".$recordset[$t][userid]."</TD>
    <TD height=25 bgColor=#ffffff>".$recordset[$t][id]."</TD>
    <TD height=25 bgColor=#ffffff>".$sortname."</TD>
	";
   $content.= "<TD height=25 bgColor=#ffffff>【<A href=\"info.php?op=addsort&id=".$recordset[$t][id]."\">添加子分类</A>】【<a href='info.php?op=editsort&id=".$recordset[$t][id]."&userid=".$recordset[$t][userid]."'>编辑</a>】【<a href='info.php?op=delsort&id=".$recordset[$t][id]."&userid=".$recordset[$t][userid]."'>删除</a>】".(($w)?(""):("【<a href=\"infolist.php?op=list&sortid=".$recordset[$t][id]."\">浏览内容</a>】【<a href=\"infoedit.php?op=add&sortid=".$recordset[$t][id]."\">添加内容</a>】"))."</TD>
  </TR>";
}
$ttt->assign("content",$content);
Ts("info/listsort.htm");

}

if($_GET[op]=='delsort'){

$ar[del]=1;
@Du('infosort',$ar,'id',$_GET[id]);
Jt($_SERVER['HTTP_REFERER'],'删除成功');
}

if($_GET[op]=='add'||$_GET[op]=='edit'){

$zd="abcdefghijklmnopqrstuvwxyz";
$ttt->assign('sortid',$_GET[sortid]);
$w=Dga('infosort',"id='".$_GET[sortid]."'");
$ttt->assign("parenttitle",$w[title]);
$info=array();$content=array();
$info=Dga('info',"id='".$_GET[id]."'");

	ob_start();
	ubb("content",stripslashes($info[content]),'../..',0,1);
	$info[content]= ob_get_contents();
	ob_end_clean();


$ttt->assign('info',$info);
		$jgs=0;
		for($ii=0;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w[$uu]=unserialize($w[$uu]);
			foreach($temp[$uu] as $key =>$value)
			{
			$w[$uu][$key]=stripslashes($value);
			}
			if($w[$uu][title]!='')
			{
	$content[$jgs][title]=$w[$uu][title];
	$content[$jgs][form]="<input name=\"".$uu."\" type=\"text\" id=\"".$uu."\"  ".stripslashes($w[$uu][style])."  ".stripslashes($w[$uu][js])."   ".stripslashes($w[$uu][chajian])."  value=\"".$info[$uu]."\" />";
	$jgs++;
			}
		}
		for($ii=0;$ii<13;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w['a'.$uu]=unserialize($w['a'.$uu]);
			foreach($w['a'.$uu] as $key =>$value)
			{
			$w['a'.$uu][$key]=stripslashes($value);
			}
			if($w['a'.$uu][title]!='')
			{$yarray=array();
			$xarray=array();
	$content[$jgs][title]=$w['a'.$uu][title];
					$temp=explode('#',$w['a'.$uu][value]);
					foreach($temp as $value)
					{
					    $ttemp=explode('-',$value);
						$yarray[]=$ttemp[0];
						$xarray[]=$ttemp[1];
					}
			if($info['a'.$uu]!='')
				{
				$w['a'.$uu][dvalue]=$info['a'.$uu];
				}

	$content[$jgs][form]=crateradio('a'.$uu,$yarray,$xarray,$msg,$w['a'.$uu][dvalue],$w['a'.$uu][style],$w['a'.$uu][js]);
	$jgs++;
			}
		}

		for($ii=13;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w['a'.$uu]=unserialize($w['a'.$uu]);
			foreach($w['a'.$uu] as $key =>$value)
			{
			$w['a'.$uu][$key]=stripslashes($value);
			}
			if($w['a'.$uu][title]!='')
			{$yarray=array();
			$xarray=array();
	$content[$jgs][title]=$w['a'.$uu][title];
					$temp=explode('#',$w['a'.$uu][value]);
					foreach($temp as $value)
					{
					    $ttemp=explode('-',$value);
						$yarray[]=$ttemp[0];
						$xarray[]=$ttemp[1];
					}

				if($info['a'.$uu]!='')
				{
				$w['a'.$uu][dvalue]=$info['a'.$uu];
				}

	$content[$jgs][form]=Bcc('a'.$uu.'[]',$yarray,$xarray,$msg,$w['a'.$uu][dvalue],$w['a'.$uu][style],$w['a'.$uu][js]);
	$jgs++;
			}
		}

			for($ii=0;$ii<10;$ii++)
			{
				$uu=substr($zd,$ii,1);
				$w['b'.$uu]=unserialize($w['b'.$uu]);
				foreach($w['b'.$uu] as $key =>$value)
				{
				$w['b'.$uu][$key]=stripslashes($value);
				}
				if($w['b'.$uu][title]!='')
				{$yarray=array();
				$xarray=array();
		$content[$jgs][title]=$w['b'.$uu][title];
						$temp=explode('#',$w['b'.$uu][value]);
						foreach($temp as $value)
						{
							$ttemp=explode('-',$value);
							$yarray[]=$ttemp[0];
							$xarray[]=$ttemp[1];
						}
			if($info['b'.$uu]!='')
				{
				$w['b'.$uu][dvalue]=$info['b'.$uu];
				}

		$content[$jgs][form]=crateselect('b'.$uu,$yarray,$xarray,$msg,$w['b'.$uu][dvalue],$w['b'.$uu][style],$w['b'.$uu][js]);
		$jgs++;
				}
			}


		for($ii=10;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w['b'.$uu]=unserialize($w['b'.$uu]);
			foreach($w['b'.$uu] as $key =>$value)
			{
			$w['b'.$uu][$key]=stripslashes($value);
			}
			if($w['b'.$uu][title]!='')
			{
	$content[$jgs][title]=$w['b'.$uu][title];
	ob_start();
	ubb("b".$uu,stripslashes($info['b'.$uu]),'../..',0,1);
	$content[$jgs][form] = ob_get_contents();
	ob_end_clean();

	$jgs++;
			}
		}

			for($ii=0;$ii<13;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w['c'.$uu]=unserialize($w['c'.$uu]);
			foreach($w['c'.$uu] as $key =>$value)
			{
			$w['c'.$uu][$key]=stripslashes($value);
			}
			if($w['c'.$uu][title]!='')
			{
	$content[$jgs][title]=$w['c'.$uu][title];
	$content[$jgs][form]=" <a href=\"#\" onClick=\"getbd('".$w['c'.$uu][value]."','".$_GET[sortid]."')\">〖<font color=red>添加".$w['c'.$uu][title]."</font>〗</a>&nbsp;&nbsp;  <a href=\"#\" onClick=\"getbdlist('".$w['c'.$uu][value]."','".$_GET[sortid]."')\">〖<font color=red>浏览".$w['c'.$uu][title]."</font>〗</a>";
	$jgs++;
			}
		}
			for($ii=13;$ii<18;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$w['c'.$uu]=unserialize($w['c'.$uu]);
			foreach($w['c'.$uu] as $key =>$value)
			{
			$w['c'.$uu][$key]=stripslashes($value);
			}
			if($w['c'.$uu][title]!='')
			{
	$content[$jgs][title]=$w['c'.$uu][title];
	$content[$jgs][form]=" <a href=\"#\" onClick=\"getpic('".$_GET[sortid]."','c".$uu."')\">超级文件上传类 </a>支持〖".$w['c'.$uu][value]."〗格式";
	$jgs++;
			}
		}

			for($ii=23;$ii<25;$ii++)//file_text
		{
			$uu=substr($zd,$ii,1);
			$w['c'.$uu]=unserialize($w['c'.$uu]);
			foreach($w['c'.$uu] as $key =>$value)
			{
			$w['c'.$uu][$key]=stripslashes($value);
			}
			if($w['c'.$uu][title]!='')
			{
	$content[$jgs][title]=$w['c'.$uu][title];
	$finfo=file($w['c'.$uu]['lujing']);
	$finfo=implode('',$finfo);
	$content[$jgs][form]="  <textarea name=\"c".$uu."\" cols=\"80\" rows=\"8\" id=\"c".$uu."\">".$finfo."</textarea>";

	$jgs++;
			}
		}

			for($ii=25;$ii<26;$ii++)//file_ubb
		{
			$uu=substr($zd,$ii,1);
			$w['c'.$uu]=unserialize($w['c'.$uu]);
			foreach($w['c'.$uu] as $key =>$value)
			{
			$w['c'.$uu][$key]=stripslashes($value);
			}
			if($w['c'.$uu][title]!='')
			{
	$content[$jgs][title]=$w['c'.$uu][title];
	$finfo=file($w['c'.$uu]['lujing']);
	$finfo=implode('',$finfo);
	ob_start();
	ubb("c".$uu,$finfo,'../..',0,1);
	$content[$jgs][form] = ob_get_contents();
	ob_end_clean();

	$jgs++;
			}
		}



			for($ii=0;$ii<6;$ii++)//sort_binding
		{
			$uu=substr($zd,$ii,1);
			$w['d'.$uu]=unserialize($w['d'.$uu]);
			foreach($w['d'.$uu] as $key =>$value)
			{
			$w['d'.$uu][$key]=stripslashes($value);
			}
			if($w['d'.$uu][title]!='')
			{
	$content[$jgs][title]=$w['d'.$uu][title];

  $drop_down_info='';
  drop_down($w['d'.$uu][sortid],0,$info['d'.$uu],"-1","全部分类");

	$dxz='';
    if($w['d'.$uu][dx]==1){
	$dxz=" name=\"d".$uu."[]\"  multiple=\"multiple\" ";
	}
	else{
	$dxz=" name=\"d".$uu."\"  ";
	}
	$content[$jgs][form] =   "<select ".$dxz."  id=\"d".$uu."\">".$drop_down_info."
	  </select>";
	$jgs++;
			}
		}





			for($ii=6;$ii<26;$ii++){
			$uu=substr($zd,$ii,1);
			$w['d'.$uu]=unserialize($w['d'.$uu]);
			foreach($w['d'.$uu] as $key =>$value)
			{
			$w['d'.$uu][$key]=stripslashes($value);
			}
		}







		$ttt->assign('sinfo',$w);


$ttt->assign('content',$content);

if($_GET[op]=='add')
{
		$ttt->assign('op','insert');
		 if($_GET[bdid]!=''&&$_GET[bdsortid]!='')
	  {
		$yongstr.="  <input  type='hidden' name='bdid' value='".$_GET[bdid]."'>";
		$yongstr.="  <input  type='hidden' name='bdsortid' value='".$_GET[bdsortid]."'>";
		$ttt->assign('yongstr',$yongstr);
	 }


}
else
{
		$ttt->assign('op','modify');

		$yongstr.="  <input  type='hidden' name='bdid' value='".$info[bdid]."'>";
		$yongstr.="  <input  type='hidden' name='bdsortid' value='".$info[bdsortid]."'>";
		$ttt->assign('yongstr',$yongstr);


}


$ttt->assign("sorts",$sorts);
Ts("info/info.htm");
}

if($_POST[op]=='insert'||$_POST[op]=='modify'){


//print_r($_POST);
//print_r($_FILES);

if($_FILES['pic']['tmp_name']!=""){
$time=time();
$otype=explode(".",strtolower($_FILES[pic][name]));
 if($_FILES[pic][size]>0&&!($_FILES[pic][type]=="image/pjpeg"||$_FILES[pic][type]=="image/gif")) {
		?>
           <script>
		           alert("图片格式不正?);
				   window.history.back(1);
		   </script>
		<?php
    }
    $filename="../../uploads/pic/".$time.".".$otype[1];
	$copymes=copy($_FILES['pic']['tmp_name'] ,$filename);
	$_POST[pic]=$time.".".$otype[1];
createthumb($_FILES['pic']['tmp_name'],".".$otype[1],$time);
 }


$_POST[adddate]=time();
$_POST[content]= stripslashes($_POST[content]);

$_POST[userid]=$_SESSION[userinfo][username];
$sortinfo=Dga('infosort'," id = '".$_POST[sortid]."'");
$zd="abcdefghijklmnopqrstuvwxyz";
	for($ii=13;$ii<26;$ii++)
	{
	  $uu=substr($zd,$ii,1);
	 $_POST['a'.$uu]=implode("#",$_POST['a'.$uu]);
	}


		for($ii=23;$ii<26;$ii++)
	{
	  $uu=substr($zd,$ii,1);
	   if(isset($_POST['c'.$uu])){

			$sortinfo['c'.$uu]=unserialize($sortinfo['c'.$uu]);
			foreach($sortinfo['c'.$uu] as $key =>$value)
			{
			$sortinfo['c'.$uu][$key]=stripslashes($value);
			}
			writefile($sortinfo['c'.$uu]['lujing'],html_entity_decode(stripslashes($_POST['c'.$uu])));
	  }
	}

//sort_binding
		for($ii=0;$ii<6;$ii++)	{
	  $uu=substr($zd,$ii,1);
	   if(isset($_POST['d'.$uu])){

			$sortinfo['d'.$uu]=unserialize($sortinfo['d'.$uu]);
			foreach($sortinfo['d'.$uu] as $key =>$value)
			{
			$sortinfo['d'.$uu][$key]=stripslashes($value);
			}

			if($sortinfo['d'.$uu][dx]=='1'){
			 $_POST['d'.$uu]=implode(",",$_POST['d'.$uu]);
			}

	  }
	}

	if($_POST[op]=='insert')
	{
	Di("info",$_POST);
	Jt("info.php?op=list&sortid=$_POST[sortid]&bdid=$_POST[bdid]&bdsortid=$_POST[bdsortid]",'添加成功');
	}
	else
	{
	Du('info',$_POST,'id',$_POST[id]);
	Jt("info.php?op=list&sortid=$_POST[sortid]&bdid=$_POST[bdid]&bdsortid=$_POST[bdsortid]",'更新成功');
	}
}

if($_GET[op]=='list'){
$sinfo=Dga('infosort',"id='".$_GET[sortid]."'");
$sinfo[cs]=unserialize($sinfo[cs]);
$sinfo[ct]=unserialize($sinfo[ct]);
$sinfo[cu]=unserialize($sinfo[cu]);
$sinfo[cv]=unserialize($sinfo[cv]);

$zd="abcdefghijklmnopqrstuvwxyz";
$xstitle=array();
$xszz=array();
$yxtitle=array();
$yxzz=array();
$zyzd=array();
$ubbzd=array();
$innerbdzd=array();
$filezd=array();
$fujiazd=0;
$sslist='';
$op1='';
$condition1='';
		for($ii=0;$ii<26;$ii++)
		{

			$uu=substr($zd,$ii,1);
			$sinfo[$uu]=unserialize($sinfo[$uu]);
			if($sinfo[$uu][title]!=''){
			if($sinfo[$uu][ss]==1){
			$sslist.="&nbsp ".$sinfo[$uu][title].":<input type='text' name='".$uu."'>";

			$op1.="&".$uu."=".$_GET[$uu];
			$condition1.=" and  ".$uu." like '%".$_GET[$uu]."%'";

			}
			if($sinfo[$uu][xs]=='1'){
				$xstitle[]=$sinfo[$uu][title];
				$xszz[]=$uu;
			}elseif ($sinfo[$uu][xs]=='0'){
				$yxtitle[]=$sinfo[$uu][title];
				$yxzz[]=$uu;

			}
			}
		}
		for($ii=0;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$sinfo['a'.$uu]=unserialize($sinfo['a'.$uu]);
			if($sinfo['a'.$uu][title]!=''){
			if($sinfo['a'.$uu][ss]=='1'){
					if($ii<13){
					$temp=explode('#',$sinfo['a'.$uu][value]);
					foreach($temp as $value)
					{
					    $ttemp=explode('-',$value);
						$yarray[]=$ttemp[0];
						$xarray[]=$ttemp[1];
					}
			$sslist.="&nbsp ".$sinfo['a'.$uu][title].":";
	$sslist.=crateradio('a'.$uu,$yarray,$xarray,$msg,$sinfo['a'.$uu][dvalue],$sinfo['a'.$uu][style],$sinfo['a'.$uu][js]);
		if($_GET['a'.$uu]!=''){
			$sinfo['a'.$uu][dvalue]=$_GET['a'.$uu];
			}
				$op1.="&a".$uu."=".$_GET['a'.$uu];
			$condition1.=" and  a".$uu." like '".$sinfo['a'.$uu][dvalue]."'";

					}
					else{
					$yarray=array();
					$xarray=array();
					$temp=explode('#',$sinfo['a'.$uu][value]);
					foreach($temp as $value)
					{
					    $ttemp=explode('-',$value);
						$yarray[]=$ttemp[0];
						$xarray[]=$ttemp[1];
					}
			$sslist.="&nbsp ".$sinfo['a'.$uu][title].":";
			$sslist.=Bcc('a'.$uu.'[]',$yarray,$xarray,$msg,$sinfo['a'.$uu][dvalue],$sinfo['a'.$uu][style],$sinfo['a'.$uu][js]);
			if($_GET['a'.$uu]!=''){
			$sinfo['a'.$uu][dvalue]=implode('#',$_GET['a'.$uu]);
			}
			$op1.="&a".$uu."=".$_GET['a'.$uu];
			$condition1.=" and  a".$uu." like '".$sinfo['a'.$uu][dvalue]."'";

					}


			}
			if($sinfo['a'.$uu][xs]=='1'){
				$xstitle[]=$sinfo['a'.$uu][title];
				$xszz[]='a'.$uu;
				$zyzd[]='a'.$uu;
			}elseif ($sinfo['a'.$uu][xs]=='0'){
				$yxtitle[]=$sinfo['a'.$uu][title];
				$zyzd[]='a'.$uu;
			}
			}
		}
		for($ii=0;$ii<10;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$sinfo['b'.$uu]=unserialize($sinfo['b'.$uu]);
			if($sinfo['b'.$uu][title]!=''){
						if($sinfo['b'.$uu][ss]=='1'){
				$yarray=array();
				$xarray=array();
				$temp=explode('#',$sinfo['b'.$uu][value]);
						foreach($temp as $value)
						{
							$ttemp=explode('-',$value);
							$yarray[]=$ttemp[0];
							$xarray[]=$ttemp[1];
						}
			$sslist.="&nbsp ".$sinfo['b'.$uu][title].":";
			$sslist.=crateselect('b'.$uu,$yarray,$xarray,$msg,$sinfo['b'.$uu][dvalue],$sinfo['b'.$uu][style],$sinfo['b'.$uu][js]);
					if($_GET['b'.$uu]!=''){
			$sinfo['b'.$uu][dvalue]=$_GET['b'.$uu];
			}
				$op1.="&b".$uu."=".$_GET['b'.$uu];
			$condition1.=" and  b".$uu." like '".$sinfo['b'.$uu][dvalue]."'";

			}

			if($sinfo['b'.$uu][xs]=='1'){
				$xstitle[]=$sinfo['b'.$uu][title];
				$xszz[]='b'.$uu;
				$zyzd[]='b'.$uu;
			}elseif ($sinfo['b'.$uu][xs]=='0'){
				$yxtitle[]=$sinfo[$uu][title];
				$yxzz[]=$uu;
				}
				}
		}
		for($ii=10;$ii<26;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$sinfo['b'.$uu]=unserialize($sinfo['b'.$uu]);
			if($sinfo['b'.$uu][title]!=''){
				$fujiazd=1;
				$ubbzd[]='a'.$uu;
			}
		}
		for($ii=0;$ii<13;$ii++)
		{
			$uu=substr($zd,$ii,1);
			$sinfo['c'.$uu]=unserialize($sinfo['c'.$uu]);
			if($sinfo['c'.$uu][title]!=''){
				$fujiazd=1;
				$innerbdtitle[]=$sinfo['c'.$uu][title];
				$innerbdzd[]=$sinfo['c'.$uu][value];
			}
		}
		$ttt->assign('fujiazd',$fujiazd);
		$ttt->assign('innerbdzd',$innerbdzd);
		$ttt->assign('innerbdtitle',$innerbdtitle);
		$ttt->assign('sslist',$sslist);
$ttt->assign('sinfo',$sinfo);


$ttt->assign('xstitle',$xstitle);
$ttt->assign('xszz',$xszz);
$ttt->assign('yxtitle',$yxtitle);
$ttt->assign('yxzz',$yxzz);



if(!isset($_GET[page])){
$_GET[page]=1;
}
if(isset($_POST[page])){
$_GET[page]=$_POST[page];
}
$ttt->assign('sortid',$_GET[sortid]);
// 搜索
$op="&op=".$_GET[op]."&sortid=".$_GET[sortid]."&title=".$_GET[title].$op1;
$condition=" and  sortid ='".$_GET[sortid]."' and ( title like '%".$_GET[title]."%' || content like '%".$_GET[title]."%' )".$condition1;
	if($_GET[bdsortid]!=''&&$_GET[bdid]!='')
	{
	$ttt->assign('links',"&bdsortid=".$_GET[bdsortid]."&bdid=".$_GET[bdid]);
	$condition=" and  bdid ='".$_GET[bdid]."'  and  bdsortid ='".$_GET[bdsortid]."' ".$condition;
	$op.="&bdsortid=".$_GET[bdsortid]."&bdid=".$_GET[bdid];
	}

$sql="select count(id) as num from ".$prefix."_info where 1  ".$condition." ;";

//echo $sql;
$res=mysql_query($sql);
$temp=mysql_fetch_array($res);
//nav
$pageline=15;$n=5;$type=2;
$pagelist=$_GET[page].",".$n.",".$pageline.",".$temp[num].",'".$op."',".$type;

shownav($pagelist);

$temp=Dgs("info"," 1   ".$condition."  LIMIT ".($_GET[page]-1)*$pageline." , ".$pageline."");

foreach($temp as $key => $value){
		for($ii=0;$ii<13;$ii++){
			$uu=substr($zd,$ii,1);
			$temp[$key]['a'.$uu]=unvar($temp[$key][sortid],'a'.$uu,$temp[$key]['a'.$uu]);
			}

		for($ii=13;$ii<26;$ii++){
			$uu=substr($zd,$ii,1);
			//ce( $temp[$key]['a'.$uu]);
			$sadfa=uncheckbox($temp[$key][sortid],'a'.$uu,$temp[$key]['a'.$uu]);

			$temp[$key]['a'.$uu]=implode('#',$sadfa);
			}

			for($ii=0;$ii<10;$ii++)
			{
			$uu=substr($zd,$ii,1);
			$temp[$key]['b'.$uu]=unvar($temp[$key][sortid],'b'.$uu,$temp[$key]['b'.$uu]);
			}
}/*
	foreach($temp as $key => $value)
	{
		$temp[$key][bb]=unvar($value[sortid],'bb',$value[bb]);
		$temp[$key][ba]=str_repeat("★",$value[ba]);
	 }
*/
$ttt->assign('content',$temp);

//ce('t');
Ts("info/infolist.htm");
}

if($_GET[op]=='del'){

$w=Dga('infosort',"id='".$_GET[sortid]."'");

//Get table'name;
if($w[tname]!=''){
$tname=$w[tname];
}else{
$tname='info';
}

$ar['del']=1;

@Du($tname,$ar,'id',$_GET[id]);
Jt($_SERVER['HTTP_REFERER'],'删除成功');
}

if($_GET[op]=='jia'){

$w=Dga('infosort',"id='".$_GET[sortid]."'");

//Get table'name;
if($w[tname]!=''){
$tname=$w[tname];
}else{
$tname='info';
}



$arrr[$_GET[zd]]='0';
Du($tname,$arrr,'id',$_GET[id]);
Jt($_SERVER['HTTP_REFERER'],'修改成功');
}
if($_GET[op]=='zhen'){
$w=Dga('infosort',"id='".$_GET[sortid]."'");
//Get table'name;
if($w[tname]!=''){
$tname=$w[tname];
}else{
$tname='info';
}



$arrr[$_GET[zd]]='1';
Du($tname,$arrr,'id',$_GET[id]);
Jt($_SERVER['HTTP_REFERER'],'修改成功');
}

if($_GET[op]=='showall'){
function getallchillrenid($id,$i)
{
global $db,$idstr,$sortlist;
$tristr="<font color='#ebebeb' style='line-height:25px;	'>|</font>";
$temp=Dgs('infosort',"parentid='".$id."' and showthis =1  and del != 1 ");
	if($temp !='')
	{
		foreach($temp as $p)
		{
				if($p[jj]=='1')
				{
				 $bjjj="【<a href='info.php?op=bjjj&sortid=$p[id]'>编辑简介</a>】".$tristr;
				}
				else
				{
				 $bjjj="";
				}
				$editfl='';
				if($p[sorte]=='1'){
				$editfl.="【<a href='info.php?op=editsort&id=$p[id]'>编辑分类</a>】";
				}
				if($p[sorta]=='1'){
				$editfl.="【<a href='info.php?op=addsort&id=$p[id]'>添加子类</a>】";
				}
				if($editfl!='')
				{
				$editfl.=$tristr;
				}


				$opinfo='';
				if($p[infoa]=='1'){
				$opinfo.="【<a href='infoedit.php?op=add&sortid=$p[id]'>添加内容</a>】";
				}
				if($p[infov]=='1'){
				$opinfo.="【<a href='./infolist.php?op=list&sortid=$p[id]'>浏览内容</a>】";
				}

			$qq=Dgs('infosort',"parentid='".$p[id]."' and showthis =1  and del != 1 ");
			if($i==0){$st="<hr width=80% align=left color='#ebebeb'>";}else{$st='';}
			if($qq!='')
			{
			$sortlist.=$st.str_repeat('－－',$i)."<font color=red>".$p[title]."</font>".$editfl.$bjjj."<BR>";
			$j=$i+1;
			getallchillrenid($p[id],$j);
			}
			else
			{
			$tj=$tristr;
			$p[cs]=unserialize($p[cs]);
				if($p[cs][title]!='')
				{
				 $tj.="【<a href='info.php?op=px&sortid=$p[id]&zd=cs'>".$p[cs][title]."排序</a>】";
				}
			$p[ct]=unserialize($p[ct]);
				if($p[ct][title]!='')
				{
				 $tj.="【<a href='info.php?op=px&sortid=$p[id]&zd=ct'>".$p[ct][title]."排序</a>】";
				}
			$p[cu]=unserialize($p[cu]);
				if($p[cu][title]!='')
				{
				 $tj.="【<a href='info.php?op=px&sortid=$p[id]&zd=cu'>".$p[cu][title]."排序</a>】";
				}
			$p[cv]=unserialize($p[cv]);
				if($p[cv][title]!='')
				{
				 $tj.="【<a href='info.php?op=px&sortid=$p[id]&zd=cv'>".$p[cv][title]."排序</a>】";
				}

			$sortlist.=$st.str_repeat('－－',$i)."<font color=red>".$p[title]."</font> ".$editfl.$bjjj.$opinfo.$tj."<BR>";
			}
		}
	}
}
if($id==''){
$_GET[id]='-1';
}
getallchillrenid($_GET[id],0);
$ttt->assign('sortlist',$sortlist);

Ts("info/contentshow.htm");
}

if($_GET[op]=='px'){

$wcfg=Dga('wcfg',"web like '".$sitename."' and lg like '".$_SESSION[LG]."'");
$wcfg=json_decode($wcfg[wcfg],true);

$webconfig[lgconfig]=$wcfg['lang'];
//print_r($_GET[lg]);

$lglist=Bcc('lg[]',array_keys($wcfg['lang']),$wcfg['lang'],$_GET['lg']);
$ttt->assign('lglist',$lglist);

$ttt->assign('zd',$_GET[zd]);
$ttt->assign('sortid',$_GET[sortid]);

// 多语言搜索
if($_GET[lg]!=''){
	foreach($_GET[lg] as $tlg){
		$sstr.=",'".$tlg."'";
	}
	$condition1.=" and lg in ('0'".$sstr.")";
}

$w=Dga('infosort',"id='".$_GET[sortid]."'");
//Get table'name;
if($w[tname]!=''){
$tname=$w[tname];
}else{
$tname='info';
}
$ttt->assign('tname',$tname);

Trs('content',$tname,"  del !='1' and sortid= '".$_GET[sortid]."' and (".$_GET[zd]." !='0' && ".$_GET[zd]." !='' ".$condition1.") order by (".$_GET[zd]."+0) desc");

$ttt->assign("zd",$_GET[zd]);
Ts("info/px.htm");
}

if($_GET[op]=='bjjj'){

$temp=Dga('info',"title like '".$_GET[sortid]."_intro'");


if($temp!='')
{	ob_start();
	ubb("content",html_entity_decode(stripslashes($temp[content])),'../..',0,1);
	$temp[content]= ob_get_contents();
	ob_end_clean();

 $ttt->assign('info',$temp);
 $ttt->assign('op','modifyjj');
}
else{
	ob_start();
	ubb("content",html_entity_decode(stripslashes($temp[content])),'../..',0,1);
	$temp[content]= ob_get_contents();
	ob_end_clean();
 $ttt->assign('info',$temp);
 $ttt->assign('op','insertjj');
}

$ttt->assign('title',$_GET[sortid]."_intro");
$ttt->assign('showubb','1');


Ts("info/infojj.htm");
}

if($_POST[op]=='insertjj'||$_POST[op]=='modifyjj'){


//print_r($_POST);
//print_r($_FILES);

if($_FILES['pic']['tmp_name']!=""){
$time=time();
$otype=explode(".",strtolower($_FILES[pic][name]));
 if($_FILES[pic][size]>0&&!($_FILES[pic][type]=="image/pjpeg"||$_FILES[pic][type]=="image/gif")) 	     {
		?>
           <script>
		           alert("图片格式不正?);
				   window.history.back(1);
		   </script>
		<?php
    }
    $filename="../../uploads/pic/".$time.".".$otype[1];
	$copymes=copy($_FILES['pic']['tmp_name'] ,$filename);
	$_POST[pic]=$time.".".$otype[1];
createthumb($_FILES['pic']['tmp_name'],".".$otype[1],$time);
 }
$_POST[adddate]=time();
$_POST[content]=htmlspecialchars( stripslashes($_POST[content]));

$_POST[userid]=$_SESSION[userinfo][username];

	if($_POST[op]=='insertjj')
	{
	Di("info",$_POST);
	Jt($_SERVER['HTTP_REFERER'],'添加成功');
	}
	else
	{
	Du('info',$_POST,'id',$_POST[id]);
	Jt($_SERVER['HTTP_REFERER'],'更新成功');
	}
}

if ($_POST[op]=="uppx") {

    foreach($_POST[px] as $id=>$tujiaorder){
            $db->query("UPDATE  ".$prefix."_".$_POST[tname]." SET ".$_POST[zd]."='".$tujiaorder."' WHERE id='".$id."'");
    }
    Jt($_SERVER['HTTP_REFERER'],"排序更新成功");
}
if ($_POST[op]=="edit") {

$_POST[lgconfig]=serialize($_POST[lgconfig]);

Du('config',$_POST,'id','1');
    Jt($_SERVER['HTTP_REFERER'],"更新成功");

}

if ($_GET[op]=="edit") {
$temp=Dga('config','id=1');
if($temp==''){
$arr[id]=1;
Di('config',$arr);
$temp=Dga('config','id=1');
}
$temp[lgconfig]=unserialize($temp[lgconfig]);

$ttt->assign('sinfo',$temp);
Ts("info/config.php");

}

?>